package com.example.yzj16478026;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import java.util.ArrayList;

public class OrderResp extends Activity {
    private ListView listView;
    private TextView total,address;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.order_res);
        Intent intent =getIntent();
        ArrayList<String> nameList=intent.getStringArrayListExtra("nameList");
        int totalCount=intent.getIntExtra("totalCount",1);
        String addr=intent.getStringExtra("addr");
        showResult(nameList,totalCount,addr);
    }

    private void showResult(ArrayList arrayList,int totalCount,String addr) {
        listView=findViewById(R.id.menu);
        total=findViewById(R.id.total);
        address=findViewById(R.id.address);
        System.out.println(totalCount);
        System.out.println(addr);
        listView.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_expandable_list_item_1,arrayList));
        total.setText("总金额为："+totalCount+"RMB");
        address.setText("送货地址为："+addr);
    }

}
